<template>
  <div id="app" class="app-layout">
    <!-- 如果是登录页面，不显示导航 -->
    <template v-if="!isLoginPage">
      <TopNavigation />
      <div class="main-content">
        <router-view />
      </div>
    </template>

    <!-- 登录页面 -->
    <template v-else>
      <router-view />
    </template>
  </div>
</template>

<script setup lang="ts">
import { computed, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { useAuthStore } from './stores/auth'
import TopNavigation from './components/TopNavigation.vue'

const route = useRoute()
const authStore = useAuthStore()

const isLoginPage = computed(() => route.path === '/login')

onMounted(async () => {
  // 初始化认证状态
  await authStore.initAuth()
})
</script>

<style>
#app {
  min-height: 100vh;
}
</style>
